#pragma once
#include "TestHarness.h"
#include "StockCallPutCombinations.h"

#include <fstream>
#include <string>

namespace
{
    std::ofstream outputFile;
}

TEST( StockCallPutCombinations, Test1 )
{
    outputFile.open( "StockCallPutCombinations_output1.csv" );

    StockCallPutCombinations subject( "|", "5" );

    subject.AddWarrant( Warrant( "5", Warrant::call, "1", 82.88, 0.069, 10 ) );
    subject.AddWarrant( Warrant( "5", Warrant::call, "2", 82.88, 0.069, 10 ) );
    subject.AddWarrant( Warrant( "5", Warrant::call, "3", 82.88, 0.069, 10 ) );
    subject.AddWarrant( Warrant( "5", Warrant::call, "4", 82.88, 0.069, 10 ) );
    subject.AddWarrant( Warrant( "5", Warrant::call, "5", 82.88, 0.069, 10 ) );

    subject.AddWarrant( Warrant( "5", Warrant::put, "11", 90, 0.29, 100 ) );                   
    subject.AddWarrant( Warrant( "5", Warrant::put, "12", 90, 0.29, 100 ) );
    subject.AddWarrant( Warrant( "5", Warrant::put, "13", 90, 0.29, 100 ) );
    subject.AddWarrant( Warrant( "5", Warrant::put, "14", 90, 0.29, 100 ) );
    subject.AddWarrant( Warrant( "5", Warrant::put, "15", 90, 0.29, 100 ) );

    subject.PrintFirstRow( "|", outputFile );
    subject.PrintCombinations( outputFile );

    outputFile.close();
}

TEST( StockCallPutCombinations, Test2 )
{
    outputFile.open( "StockCallPutCombinations_output2.csv" );

    StockCallPutCombinations subject( "|", "5" );
    subject.AddWarrant( Warrant( "5", Warrant::call, "1", 82.88, 0.069, 10 ) ); 
    subject.AddWarrant( Warrant( "5", Warrant::put, "13", 90, 0.29, 100 ) );
    subject.AddWarrant( Warrant( "5", Warrant::call, "2", 82.88, 0.069, 10 ) );
    subject.AddWarrant( Warrant( "5", Warrant::put, "11", 90, 0.29, 100 ) );                   
    subject.AddWarrant( Warrant( "5", Warrant::call, "3", 82.88, 0.069, 10 ) );
    subject.AddWarrant( Warrant( "5", Warrant::put, "12", 90, 0.29, 100 ) );
    subject.AddWarrant( Warrant( "5", Warrant::put, "14", 90, 0.29, 100 ) );
    subject.AddWarrant( Warrant( "5", Warrant::call, "4", 82.88, 0.069, 10 ) );
    subject.AddWarrant( Warrant( "5", Warrant::put, "15", 90, 0.29, 100 ) );
    subject.AddWarrant( Warrant( "5", Warrant::call, "5", 82.88, 0.069, 10 ) );

    subject.PrintFirstRow( "|", outputFile );
    subject.PrintCombinations( outputFile );

    outputFile.close();
}

TEST( StockCallPutCombinations, Test3 )
{
    outputFile.open( "StockCallPutCombinations_output3.csv" );

    StockCallPutCombinations subject( "|", "5" );

    subject.PrintFirstRow( "|", outputFile );
    subject.PrintCombinations( outputFile );

    outputFile.close();
}